package com.ruimei.controller;

import com.ruimei.entitys.CourseChange;
import com.ruimei.entitys.RmCourse;
import com.ruimei.entitys.Teacher;
import com.ruimei.service.CourseService;
import com.ruimei.util.TokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Api(tags={"课表"})
@Controller
public class CourseController
{
  @Resource
  CourseService courseService;
  
  @ApiOperation("W通过教师的ID查询教师的课表")
  @GetMapping({"/teacher/course"})
  @ResponseBody
  public Map<String, Object> getTeacherCoursebyteacherId(HttpServletRequest request)
  {
    Map<String, Object> map = this.courseService.getTeacherCoursebyteacherId(TokenUtils.getTeacherId(request));
    return map;
  }
  
  @ApiOperation("通过班级id查看课表")
  @GetMapping({"/parent/course/{classId}"})
  @ResponseBody
  public Map<String, Object> getClassCourse(@PathVariable String classId)
  {
    return this.courseService.getClassCourse(classId);
  }

  @ApiOperation("查看可换课程")
  @PostMapping({"/course/other"})
  @ResponseBody
  public Map<String, Object> getOther(RmCourse rmCourse)
  {
    return this.courseService.getOther(rmCourse);
  }

  @ApiOperation("添加调课")
  @PostMapping({"/course/add"})
  @ResponseBody
  public Map<String, Object> addChange(CourseChange courseChange)
  {
    return this.courseService.addChange(courseChange);
  }

  @ApiOperation("修改调课")
  @PostMapping({"/course/set"})
  @ResponseBody
  public Map<String, Object> setChange(CourseChange courseChange)
  {
    return this.courseService.setChange(courseChange);
  }


  @ApiOperation("获取调课列表")
  @PostMapping({"/course/get"})
  @ResponseBody
  public Map<String, Object> getChange(CourseChange courseChange)
  {
    return this.courseService.getChange(courseChange);
  }
}

